<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

class AgreementController extends BaseController
{
    public $validate = [
        "getDetail" => [
            "rules" => [
                "route" => "required|string|max:20",
            ]
        ],
    ];

    /**
     * @path /agreement/get-detail
     * @category 协议
     * @title 详情
     * @method POST
     * @params [{"name":"route","type":"text","required":1,"example":"agreement-privacy","desc":"协议路由"}]
     * @resBody {"success":true,"statusCode":200,"result":{"title":"这是协议标题","content":"这是协议内容"},"message":"OK"}
     */
    public function getDetail(Request $request)
    {
        $route = $request->post('route');

        $agreement = service()->AgreementService->getAgreement($route);

        return $this->apiReturn($agreement);
    }
}
